﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Peekaboo2008.dao;
using CrystalDecisions.CrystalReports.Engine;

namespace Peekaboo2008.view
{
    public partial class FormReportViewerXuatBanHangHoa : Form
    {
        public FormReportViewerXuatBanHangHoa()
        {
            InitializeComponent();
            LoadReport();
        }

        /**/
        // Dua id cua chi nhanh va ngay xem bao cao de load thong tin can xem
        /**/

        public void LoadReport()
        {
            String applicationPath = Application.StartupPath.Replace("\\bin\\Debug", "");
            String pathReport = @"\report\";
            DataTable dataTableDoanhSo = PhieuNhapXuatDAO.GetHoaDonXuatBanHangHoaByMaxId();
            ReportDocument rdmReportDocument = new ReportDocument();
            // load crystal report vao report document
            rdmReportDocument.Load(applicationPath + pathReport + "CrystalReportXuatBanHangHoa.rpt");
            rdmReportDocument.SetDataSource(dataTableDoanhSo);
            crvReportViewer.ReportSource = rdmReportDocument;
            crvReportViewer.Visible = true;
            crvReportViewer.Refresh();
        }
    }
}
